package com.dayatang.exam.domain;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 问答题答�?
 * @author yang
 *
 */
@Entity
@DiscriminatorValue("Q")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class QuizSolution extends QuestionSolution {

	private static final long serialVersionUID = -7534902973563523352L;

	public QuizSolution() {
	}

	public QuizSolution(QuizQuestion question, int point, int position) {
		super(question, point, position);
	}

	@Override
	public QuizQuestion getQuestion() {
		return getRepository().get(QuizQuestion.class, getQuestion().getId());
	}
	
	public int[] getPointMap() {
		int maxPoint = getPoint() + 1;
		int[] result = new int[maxPoint]; 
		for (int i = 0; i < maxPoint; i++) {
			result[i] = i;
		}
		return result;
	}
}
